﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Kopytko.BoardGame;
using Kopytko.GameBase;

namespace Kopytko.Games.Checkers
{
    /// <summary>
    /// Interaction logic for Checker.xaml
    /// </summary>
    public partial class Checker : Pawn
    {
        public enum CheckerColor
        {
            Red,
            White,
        }


        public Brush CheckerBg
        {
            get { return (Brush)GetValue(CheckerBgProperty); }
            set { SetValue(CheckerBgProperty, value); }
        }

        private PawnColor _color;

        public PawnColor Color
	    {
		    get { return _color;}
		    set 
            { 
                _color = value;

                switch(_color)
                {
                    case PawnColor.Black:
                        CheckerBg = FindResource("CheckerBg1") as Brush;
                        break;
                    case PawnColor.White:
                        CheckerBg = FindResource("CheckerBg2") as Brush;
                        break;
                }
            }
	    }

        public static readonly DependencyProperty CheckerBgProperty =
            DependencyProperty.Register("CheckerBg", typeof(Brush), typeof(Checker), new UIPropertyMetadata(Brushes.Black));

        


        public Checker(BoardPlayer boardPlayer, BoardPosition boardPosition)
        {
            InitializeComponent();

            this.Color = boardPlayer.Color;
            X = boardPosition.X;
            Y = boardPosition.Y;
        }
    }
}
